import cv2
import numpy as np
img1=cv2.imread(r"D:\Project\Project37\Project37\tupian\opencvsearch.png")
img2=cv2.imread(r"D:\Project\Project37\Project37\tupian\opencv.jpg")
gray1=cv2.cvtColor(img1,cv2.COLOR_BGR2GRAY)
gray2=cv2.cvtColor(img2,cv2.COLOR_BGR2GRAY)
sift=cv2.SIFT_create()
kp1,des1=sift.detectAndCompute(gray1,None)
kp2,des2=sift.detectAndCompute(gray2,None)
bf=cv2.BFMatcher(cv2.NORM_L1)
match=bf.match(des1,des2)
img3=cv2.drawMatches(img1,kp1,img2,kp2,match,None)
cv2.imshow('img3',img3)
cv2.waitKey(0)
